**********************************************************************************************
* Reproduces Table 3
*
* Ajzenman, Elacqua, Jaimovich and Pérez-Núñez (2024)."Humans versus Chatbots: Scaling-up behavioral interventions to reduce teacher shortages"  	  		
*
**********************************************************************************************

matrix drop _all

mat D=J(26,5,.)
local i= 1
local j= 2

*balance check for interesed in social sciences 

mat D=J(26,3,.)
local i= 1
local j= 2

foreach var in sexo municipal subvencionado particular top_30 agno_egreso prom_notas ptje_ranking prom_cm_actual padres_incompleta padres_media_completa padres_superior bajo_linea_pobreza{
	
sum `var' if grupo_det== "Bot B"
mat D[`i',1]= r(mean)
mat D[`j',1]= r(sd)

sum `var' if grupo_det== "Control B"
mat D[`i',2]= r(mean)
mat D[`j',2]= r(sd)

*ttest bot vs control interesed in social sciences
preserve
drop if education_preference==1
ttest `var' , by(grupo_det) 
mat D[`i',3]= r(mu_1) - r(mu_2)
restore 

local i =`i'+2
local j =`j'+2
}

matlist D

mat rownames D= "Female" "." "Public" "." "Private-Subsidized" "." "Private" "." "High school GPA, top 30%" "." "Recent year graduation"  "." "High school GPA" "." "High school ranking score" "." "Average math and verbal test" "." "Parents without high school" "." "Parents with high school" "." "Parents with higher education" "." "Low income family" "."

mat colnames D= "Bot" "Control" "Bot vs Control"

matlist D

frmttable using "${output}/Table3.tex", statmat(D) varlabels replace sdec(0,3,3,0,0,0) tex fr
